//
//  Emoticons.swift
//  emoticonKB
//
//  Created by mac on 16/3/21.
//  Copyright © 2016年 mac. All rights reserved.
//


//-----------------表情属性---------------------

import UIKit

class Emoticons: NSObject {

    //分组表情的路径
    var id: String?
    
    var imagePath: String?
    
    //微博图片对应的表情文字
    var chs: String?
    //本地显示图片
    var png: String? {
    
        didSet {
            if let img = png {
                imagePath = NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + (id ?? "") + "/" + img
            }
        }
    }
    
    //Emoji表情对应的16进制的字符串
    var code: String? {
    
        didSet {
        
            if let c = code {
            
                codeStr = c.emojiStr()
            }
        }
    }
    var codeStr: String?
    //KVC赋值
    init(id: String,dict: [String : String] ) {
        super.init()
        
        self.id = id
        
        self.setValuesForKeysWithDictionary(dict)
    }
    
    //标识是否是删除按钮
    var isDelete = false
    
    // 标识是否是空白按钮
    var isEmpty = false
    
    init(isDelete: Bool) {
        self.isDelete = isDelete
        super.init()
    }
    
    init(isEmpty: Bool) {
        self.isEmpty = isEmpty
        super.init()
    }
    
    //过滤
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    
    //MARK: 重写描述方法 方便打印字典内容
    override var description: String {
        let keys = ["chs","png","code"]
        let dict = self.dictionaryWithValuesForKeys(keys)
        return dict.description
    }
    
    
    
}
